/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.suarte.webapp.action;

import com.suarte.core.service.RemissionManager;
import com.suarte.core.Company;
import com.suarte.core.Contact;
import com.suarte.core.service.CompanyManager;
import com.suarte.core.service.ContactManager;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import org.appfuse.service.GenericManager;

/**
 * @date   Feb 18, 2011
 * @author Ggutierrez
 */
public class RemissionList extends BasePage implements Serializable {
    private RemissionManager remissionManager;
    private CompanyManager companyManager;
    private ContactManager contactManager;
    private Long id;
    private Long quotationId;
    private Long workOrderId;
    private String description;
    private String user;
    private Date date;
    private List remissions;
    private List<Company> companies;
    private Company company;
    private List<Contact> contacts;
    private Contact contact;

    public RemissionList() {
        setSortColumn("id"); // sets the default sort column
    }

    public void setRemissionManager(RemissionManager remissionManager) {
        this.remissionManager = remissionManager;
    }

    public void setCompanyManager(CompanyManager companyManager) {
        this.companyManager = companyManager;
    }

    public ContactManager getContactManager() {
        return contactManager;
    }

    public void setContactManager(ContactManager contactManager) {
        this.contactManager = contactManager;
    }

    public String execute() {
        remissions = sort(remissionManager.findRemissions(id, quotationId, workOrderId, description, date, company, contact));

        return "list";
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getQuotationId() {
        return quotationId;
    }

    public void setQuotationId(Long quotationId) {
        this.quotationId = quotationId;
    }

    public Long getWorkOrderId() {
        return workOrderId;
    }

    public void setWorkOrderId(Long workOrderId) {
        this.workOrderId = workOrderId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public List getRemissions() {
        return remissions;
    }

    public void setRemissions(List remissions) {
        this.remissions = remissions;
    }

    public List<Company> getCompanies() {
        companies = companyManager.findCompanies();
        return companies;
    }

    public void setCompanies(List<Company> companies) {
        this.companies = companies;
    }

    public Company getCompany() {
        return company;
    }

    public void setCompany(Company company) {
        this.company = company;
    }

    public List<Contact> getContacts() {
        //contacts = contactManager.getAll();
        return contacts;
    }

    public void setContacts(List<Contact> contacts) {
        this.contacts = contacts;
    }

    public Contact getContact() {
        return contact;
    }

    public void setContact(Contact contact) {
        this.contact = contact;
    }


}
